package com.org.gsc.zuixindemo;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;

import com.takusemba.multisnaprecyclerview.MultiSnapRecyclerView;
import com.takusemba.multisnaprecyclerview.OnSnapListener;

/**
 * Created by qundui on 2017/10/23.
 */
public class MultiSnapRecyclerViewDemo extends AppCompatActivity {
    //Make sure to use LinearManger. Other managers are not supported.
    private MultiSnapRecyclerView  mMultiSnapRecyclerView,rv1;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.murv);
        mMultiSnapRecyclerView= (MultiSnapRecyclerView) findViewById(R.id.rv);
        LinearLayoutManager layoutManager = new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false);
        mMultiSnapRecyclerView.setLayoutManager(layoutManager);
        mMultiSnapRecyclerView.setAdapter(new MyAdapter(MultiSnapRecyclerViewDemo.this,URLutils.mdata));
        mMultiSnapRecyclerView.setOnSnapListener(new OnSnapListener() {
            @Override
            public void snapped(int position) {
                // do something with the position of the snapped view
            }
        });
        rv1= (MultiSnapRecyclerView) findViewById(R.id.rv1);
        LinearLayoutManager layoutManager1 = new LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false);
        rv1.setLayoutManager(layoutManager1);
        rv1.setAdapter(new MyAdapter(MultiSnapRecyclerViewDemo.this,URLutils.mdata));
        rv1.setOnSnapListener(new OnSnapListener() {
            @Override
            public void snapped(int position) {
                // do something with the position of the snapped view
            }
        });
    }

}
